<%@page import="com.zt.exp5.bean.Product"%>
<%@page import="com.zt.exp5.bean.Car"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>购物车</title>
<style>
.tb {
	border: 1px solid blue;
	border-collapse: collapse; /*设置表格的边框合并为一个单一的边框*/
	width: 800px;
	margin: 10px auto;
}

.tb th,td {
	border: 1px solid blue;
	padding: 10px;
}
</style>
</head>

<body>
	<jsp:useBean id="car" type="com.zt.exp5.bean.Car" scope="session"></jsp:useBean>
	<table class="tb">
		<tr>
			<th colspan="5">
				购买的商品如下
			</th>
		</tr>
		<tr>
			<th>名称</th>
			<th>价格(元/斤)</th>
			<td>数量</td>
			<td>总价</td>
			<th>移除(-1/次)</th>
		</tr>
		<%
			for(Product p : car.getList()){
		%>
		<tr>
			<td><%=p.getName() %></td>
			<td><%=p.getPrice() %></td>
			<td><%=p.getNumber() %></td>
			<td><%=p.getTotalPrice() %></td>
			<td><a href="doAction1.jsp?action=remove&id=<%=p.getId()%>">移除</a></td>
		</tr>
		<%
			}
		%>
		
		<tr>
			<td colspan="3"><a href="buy1.jsp">继续购物</a></td>
			<td colspan="2"><a href="doAction1.jsp?action=clear">清空购物车</a></td>
		</tr>
	</table>
</body>
</html>
